/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

/**
 *
 * @author phong
 */
public class Pair <T1, T2> {
    T1 first;
    T2 second;

    public Pair(T1 first, T2 second) {
        this.first = first;
        this.second = second;
    }

    public T1 getFirst() {
        return first;
    }

    public void setFirst(T1 first) {
        this.first = first;
    }

    public T2 getSecond() {
        return second;
    }

    public void setSecond(T2 second) {
        this.second = second;
    }

    @Override
    public int hashCode() {
        return first.hashCode() *31 + second.hashCode();
    }
    
    @Override
    public boolean equals(Object o) {
        if (o instanceof Pair) {
            Pair that = (Pair)o;
            return that.first.equals(this.first) && that.second.equals(this.second);
        }
        return false;
    }
    
    @Override
    public String toString() {
        return "(" + this.first.toString() + "," + this.second.toString() + ")";
    }
}
